package huadi.android.graphics;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.os.Bundle;
import android.view.View;

public class GraphicsActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		GraphicsView gv = new GraphicsView(this);
		setContentView(gv);
	}

	static public class GraphicsView extends View {
		public GraphicsView(Context context) {
			super(context);
		}

		@Override
		protected void onDraw(Canvas canvas) {
			setBackgroundResource(R.drawable.colors);
			// 3 method to obtain a color value
			@SuppressWarnings("unused")
			int color = Color.BLUE;
			color = Color.argb(127, 255, 0, 255);
			color = getResources().getColor(R.color.mycolor);

			Paint cPaint = new Paint();
			cPaint.setColor(Color.LTGRAY);
			final String QUOTE = "I love you. I love you. I love you. I love you. I love you. I love you. ";
			Path circle = new Path();
			circle.addCircle(150, 150, 100, Direction.CW);
			canvas.drawPath(circle, cPaint);
			cPaint.setColor(getResources().getColor(R.color.mycolor));
			canvas.drawTextOnPath(QUOTE, circle, 0, 20, cPaint);
		}
	}
}